<html>
<style>
    .arrow {
        position: absolute;
        top: 50%;
        right: 15px;
        content: '';
        display: block;
        width: 8px;
        height: 16px;
        transform: translateY(-50%);
    }

    .pic-lack {
        margin-top: 80px;
    }

    #mySub .list-block .title-row {
        line-height: 42px;
        margin-top: 4px;
    }

    .list-block .item-inner:after {
        height: 0 !important;
    }
</style>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>通讯录</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" type="text/css" href="${staticpath}/front/dist/css/sm.css">
    <link rel="stylesheet" type="text/css" href="${staticpath}/front/dist/css/sm-extend.css">
    <link rel="stylesheet" type="text/css" href="${staticpath}/front/dist/css/layout.css">
    <link rel="stylesheet" type="text/css" href="${staticpath}/front/dist/css/base.css">
</head>
<body id="mySub">
<div class="page-group">
    <div class="page" id="page-infinite-scroll-bottom">
        <!--头部部分 !-->
        <header class="bar bar-nav">
            <a class="icon icon-left pull-left back" href="${basepath}/rest/front/user/toMyPage"></a>

            <h1 class="title">通讯录</h1>
        </header>
        <div class="content account-content infinite-scroll infinite-scroll-bottom" data-distance="200">
            <div class="information-card" data-url="${basepath}/rest/front/user/toSubDetail">

            </div>
        </div>
    </div>
</div>
<script type='text/javascript' src='${staticpath}/front/dist/js/lib/zepto.js' charset='utf-8'></script>
<script>
    $.config = {
        router: false
    }
</script>
<script type='text/javascript' src='${staticpath}/front/dist/js/lib/sm.js' charset='utf-8'></script>
<script type='text/javascript' src='${staticpath}/front/dist/js/lib/sm-extend.js' charset='utf-8'></script>
<script>
    $.ajax({
        type: "GET",
        url: "/rest/front/user/selectSubList",
        dataType: "json",
        success: function (data) {
            var dataList = data.data;
            var userHtml = "";
            if (data.data == '' || data.data == null) {
                userHtml += '<img src="/resource/front/dist/images/lack_6.png" alt="" class="pic-lack" style="display: block"> <div class="text-lack" style="display: block"> 亲，你还没有通讯录哦～</div>';
            } else {
                $.each(dataList, function (i, o) {
                    userHtml += '<div class="card-content" data-id="' + o.id + '"><div class="list-block media-list">  <li class="item-content"> <span class="img-box"><img src="' + o.icon + '" width="46"></span><div class="item-inner"><div class="title-row"><div class="item-title">' + o.nickname + '</div>  </div></div><span><img src="${staticpath}/front/dist/images/right.png" class="arrow" alt=""> </li><div class="underline"></div> </div></div>';
                });
            }
            $(".information-card").html(userHtml);
            $(".card-content").click(function () {
                var id = $(this).attr('data-id');
                var url = $('.information-card').attr('data-url');
                url = url + "?id=" + id;
                window.location.href = url;
            });

        }
    });
    $.init();
</script>
</body>

</html>
